<template>
  <div class="contractM">
    <x-header>合同签订
      <a href="javascript:;" class="save" @click="saveAction(submitType)">保存</a>
		  <a href="javascript:;" class="submit" @click="submitAction">提交</a>
    </x-header>
    <div class="contractMContent">
      <div class="maintain-title">
        <img  class="maintain-title-icon" src="../../assets/img/securityCheckImg/titledecoration.png" alt="">
        <div class="maintain-title-text">
          用气方信息
        </div>
      </div>
      <div class="information-item">
        <div class="information-item-title">用气方签约人</div>
        <input class="information-item-input" v-model="FILE_NAME" type="text" maxlength="13" placeholder="请录入" value="">
        <img class="information-item-icon" src="../../assets/img/securityCheckImg/sao.png" @click.stop="scanNewMeterAction" alt="">
      </div>
      <div class="information-item">
        <div class="information-item-title">证件类型</div>
         <popup-picker class="information-item-input" :data="CERT_TYPE_LIST" show-name v-model="CERT_TYPE" @on-change="onPopupChange($event, 'CERT_TYPE')" placeholder="请选择"></popup-picker>
        <!-- <img  class="information-item-rightImg" src="../../assets/img/securityCheckImg/rightArrow.png" alt=""> -->
      </div>
      <div class="information-item">
        <div class="information-item-title">证件号码</div>
        <input class="information-item-input"  v-model="CERT_NUM" type="text" maxlength="13" placeholder="请录入" value="">
        <img class="information-item-icon" src="../../assets/img/securityCheckImg/sao.png" @click.stop="scanNewMeterAction" alt="">
      </div>
      <div class="information-item">
        <div class="information-item-title">联系电话</div>
        <input class="information-item-input" v-model="CONT_PHONE" type="text" maxlength="11" placeholder="请录入" value="">
      </div>
      <!-- 不确定 -->
      <div class="maintain-title">
        <img  class="maintain-title-icon" src="../../assets/img/securityCheckImg/titledecoration.png" alt="">
        <div class="maintain-title-text">
          代办人信息（非必填）
        </div>
      </div>
      <div class="information-item">
        <div class="information-item-title">姓名</div>
        <input class="information-item-input" v-model="AGENT_NAME" type="text" maxlength="13" placeholder="请录入" value="">
        <img class="information-item-icon" src="../../assets/img/securityCheckImg/sao.png" @click.stop="scanNewMeterAction" alt="">
      </div>
      <div class="information-item">
        <div class="information-item-title">证件类型</div>
         <popup-picker class="information-item-input" :data="AGENT_GERT_TYPE_LIST" show-name v-model="AGENT_GERT_TYPE"  @on-change="onPopupChange($event, 'AGENT_GERT_TYPE')" placeholder="请选择"></popup-picker>
        <!-- <img  class="information-item-rightImg" src="../../assets/img/securityCheckImg/rightArrow.png" alt=""> -->
      </div>
      <div class="information-item">
        <div class="information-item-title">证件号码</div>
        <input class="information-item-input" v-model="AGENT_CERT_NUM" type="text" maxlength="13" placeholder="请录入" value="">
        <img class="information-item-icon" src="../../assets/img/securityCheckImg/sao.png" @click.stop="scanNewMeterAction" alt="">
      </div>
      <div class="information-item">
        <div class="information-item-title">联系电话</div>
        <input class="information-item-input" v-model="AGENT_TEL" type="text" maxlength="11" placeholder="请录入" value="">
      </div>
      <!-- 不确定 -->
      <div class="maintain-title">
        <img  class="maintain-title-icon" src="../../assets/img/securityCheckImg/titledecoration.png" alt="">
        <div class="maintain-title-text">
          合同信息
        </div>
      </div>
      <div class="information-item">
        <div class="information-item-title">供气方签约人</div>
        <input class="information-item-input" type="text" v-model="ELEC_FILE_NAME" disabled maxlength="11" placeholder="请录入" value="">
      </div>
      <div class="information-item">
        <div class="information-item-title">合同编码</div>
        <input class="information-item-input" v-model="CONT_NO" type="text" placeholder="请录入" value="">
        <img class="information-item-icon" src="../../assets/img/securityCheckImg/sao.png" @click.stop="scanNewMeterAction" alt="">
      </div>
      <div class="information-item">
        <!--  -->
        <div class="information-item-title">签订类型</div>
         <popup-picker class="information-item-input" :data="SIGN_TYPE_LIST" show-name  v-model="SIGN_TYPE"  @on-change="onPopupChange($event, 'SIGN_TYPE')" placeholder="请选择"></popup-picker>
        <!-- <img  class="information-item-rightImg" src="../../assets/img/securityCheckImg/rightArrow.png" alt=""> -->
      </div>
      <!--  -->
      <div class="information-item">
        <div class="information-item-title">签订来源</div>
        <input class="information-item-input" v-model="SIGN_ADDR" type="text" maxlength="11" placeholder="请录入" value="">
      </div>
      <div class="information-item">
        <div class="information-item-title">合同生效日期</div>
        <datetime class="information-item-input" placeholder="请选择" v-model="EFFECT_DATE" ></datetime>
        <!-- <img  class="information-item-rightImg" src="../../assets/img/securityCheckImg/rightArrow.png" alt=""> -->
      </div>
      <div class="information-item">
        <div class="information-item-title">合同到期日期</div>
        <datetime class="information-item-input" placeholder="请选择" v-model="END_DATE" ></datetime>
        <!-- <input class="information-item-input" v-model="END_DATE" type="text" maxlength="11" placeholder="请录入" value=""> -->
      </div>
      <div class="information-item">
        <!-- 找不到 -->
        <div class="information-item-title">气费价格</div>
         <popup-picker class="information-item-input" :data="PRC_CODE_LIST" show-name v-model="PRC_CODE" @on-change="onPopupChange($event, 'PRC_CODE')" placeholder="请选择"></popup-picker>
        <!-- <img  class="information-item-rightImg" src="../../assets/img/securityCheckImg/rightArrow.png" alt=""> -->
      </div>
      <div class="information-item">
        <div class="information-item-title">房屋建筑面积</div>
        <input class="information-item-input"  v-model="HOUSING_AREA" type="text" maxlength="11" placeholder="请录入" value="">
      </div>
      <div class="information-item">
        <div class="information-item-title">合同附件</div>
      </div>
      <div class="information-images">
      <div class="information-image information-image-positive" v-if="photoPathZ == ''" @click="takePhoto($event,1)">
        <img class="information-image-icon" src="../../assets/img/securityCheckImg/camera.png" alt="">
        <div class="information-image-text">证件正面照</div>
      </div>
      <div class="information-image information-image-positive information-image-path" v-else>
        <img  class="information-image-iconDelete" @click="deletePhoto($event,1)" src="../../assets/img/securityCheckImg/deletephoto.png" alt="">
        <img class="information-image-iconPath" :src="photoPathZ" alt="">
      </div>
      <div class="information-image information-image-nopositive" v-if="photoPathF == ''" @click="takePhoto($event,2)">
        <img class="information-image-icon" src="../../assets/img/securityCheckImg/camera.png" alt="">
        <div class="information-image-text">证件反面照</div>
      </div>
      <div class="information-image information-image-positive information-image-path" v-else>
        <img  class="information-image-iconDelete" @click="deletePhoto($event,2)" src="../../assets/img/securityCheckImg/deletephoto.png" alt="">
        <img class="information-image-iconPath" :src="photoPathF" alt="">
      </div>
    </div>
      <div class="information-item">
        <div class="information-item-title">用户手册</div>
        <div class="information-item-radio information-item-input">
          <label class="information-item-radio-y">
            <input type="radio" name="radio1" value="0" @change="bindRadio">
            <img class="information-item-radio-icon" src="../../assets/img/securityCheckImg/unselected.png" alt="" v-if="radioShowY">
            <img class="information-item-radio-icon" src="../../assets/img/securityCheckImg/selected.png" alt="" v-else>
            <div class="information-item-radio-text">已发放</div>
          </label>
          <label class="information-item-radio-n">
            <input type="radio" name="radio1" value="1" @change="bindRadio">
            <img class="information-item-radio-icon" src="../../assets/img/securityCheckImg/unselected.png" alt="" v-if="radioShowN">
            <img class="information-item-radio-icon" src="../../assets/img/securityCheckImg/selected.png" alt="" v-else>
            <div class="information-item-radio-text">未发放</div>
          </label>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { XHeader, PopupPicker, Datetime, dateFormat } from "vux";
import Vue from "vue";
import { getsn, getYYYYMM, getFileYYYYMMDDHH24MISS } from "@/utils/getsn";
import { deletePhoto, UserInfo } from "@/utils/public";
import {
  userInfoFn,
  sqlQuery,
  scanNewMeterAction,
  sqlInsert,
  sqlUpdata,
  sqlFILE_Query,
  sqlFILE_Insert,
  sqlFILE_Delete,
  sqlFILE_QueryAll,
  takePhotoAll,
  submitremoval,
  sqlUpdataChange
} from "@/utils/sqlOperation";
export default {
  data() {
    return {
      value1: ["居民"],
      title1: "手机机型",
      list1: [
        ["小米1", "iPhone1", "华为1", "情怀1", "三星1", "其他1", "不告诉你1"]
      ],
      radioShowY: false,
      radioShowN: true,
      FILE_NAME: "",
      CERT_NUM: "",
      CONT_PHONE: "",
      ELEC_FILE_NAME: UserInfo.USER,
      CONT_NO: "",
      SIGN_ADDR: "",
      END_DATE: "",
      AGENT_TEL: "",
      CERT_TYPE_LIST: [],
      CERT_TYPE: [],
      SIGN_TYPE_LIST: [],
      SIGN_TYPE: [],
      PRC_CODE: [],
      PRC_CODE_LIST: [],
      AGENT_GERT_TYPE: [],
      AGENT_GERT_TYPE_LIST: [],
      AGENT_CERT_NUM: "",
      HOUSING_AREA: "",
      AGENT_NAME: "",
      EFFECT_DATE: "",
      CONS_NO: "",
      photoPathZ: "",
      photoPathF: "",
      photoPathType: "",
      FILE: [],
      FILE_LIST: [],
      change_type: 1,
      M_CID: "",
      submitType: 1,
      userInfoData: null
    };
  },
  components: {
    XHeader,
    PopupPicker,
    Datetime
  },
  filters: {
    dateFormat
  },
  methods: {
    userInfoCallback(msg) {
      console.log("用户信息查询", msg);
      Vue.set(this, "userInfoData", msg[0]);
    },
    queryPhotoCallback(result) {
      console.log(1111, result);
      if (result.length != 0) {
        for (let i in result) {
          if (result[i].DIRECTION_TYPE == "1") {
            console.log(result[i]);
            Vue.set(this, "photoPathZ", result[i].FILE_SRC);
          } else {
            Vue.set(this, "photoPathF", result[i].FILE_SRC);
          }
        }
      }
      Vue.set(this, "FILE_LIST", JSON.parse(JSON.stringify(result)));
      Vue.set(this, "FILE", JSON.parse(JSON.stringify(result)));
    },
    //图片上传
    takePhoto(event, type) {
      Vue.set(this, "photoPathType", type);
      takePhotoAll(this.takePhotoCallback);
    },
    takePhotoCallback(result) {
      if (this.photoPathType == 1) {
        Vue.set(this, "photoPathZ", result.path);
        this.FILE.push({
          FILE_ID: new Date().getTime() + "",
          PATH: result.path,
          DIRECTION_TYPE: "1"
        });
      } else {
        Vue.set(this, "photoPathF", result.path);
        this.FILE.push({
          FILE_ID: new Date().getTime() + "",
          PATH: result.path,
          DIRECTION_TYPE: "2"
        });
      }
      console.log("合同信息", this.FILE);
    },
    deletePhoto(event, type) {
      for (let i in this.FILE) {
        if (this.FILE[i].DIRECTION_TYPE == type) {
          this.FILE.splice(i, 1);
        }
      }
      console.log(this.FILE);
      console.log(this.FILE_LIST);
      if (type == 1) {
        Vue.set(this, "photoPathZ", "");
      } else {
        Vue.set(this, "photoPathF", "");
      }
    },
    photoFileCallback(str, msg) {
      console.log(11111, str, msg);
    },
    fileFunction() {
      const _this = this;
      _this.$vux.loading.show({
        text: "加载中"
      });
      for (let i in this.FILE) {
        let fileName =
          "/IMG/" +
          getYYYYMM() +
          "/" +
          "" +
          "_" +
          _this.CONS_NO +
          "_" +
          "1202" +
          "_" +
          getFileYYYYMMDDHH24MISS();
        AndroidApi.insert(
          JSON.stringify({
            tableName: "FILE_RECORDE",
            contentValues: [
              {
                FILE_ID: _this.FILE[i].FILE_ID,
                APP_NO: "",
                CONS_NO: _this.CONS_NO,
                FILE_SRC: _this.FILE[i].PATH,
                FILE_NAME: fileName,
                ITEM_NO: "1202",
                BUSY_NO: "0"
              }
            ]
          }),
          function(msg) {
            if (msg.resultCode === "9999") {
              _this.$vux.loading.hide();
            } else {
              errorCall("error", msg);
            }
          }
        );
      }
    },
    fileInsert(M_CID) {
      if (this.FILE.length == 2) {
        this.fileFunction();
        for (let i in this.FILE) {
          const fileData = [
            {
              M_CID: getsn(),
              CONTRACT_CID: M_CID,
              FILE_ID: this.FILE[i].FILE_ID,
              DIRECTION_TYPE: this.FILE[i].DIRECTION_TYPE
            }
          ];
          sqlFILE_Insert(
            "CONTRACT_FILE_RELATION",
            fileData,
            this.photoFileCallback
          );
        }
      } else if (this.FILE.length != 0) {
        this.$vux.toast.text("请上传证件正反面照片");
        return;
      }
    },
    scanNewMeterAction() {
      scanNewMeterAction("METER_NO", this.scanCallback);
    },
    scanCallback(filed, codeStr) {
      if (filed == "METER_NO") {
        Vue.set(this, "PROD_BAR", codeStr);
      }
    },

    onPopupChange(val, str) {
      console.log("val change", val);
      switch (str) {
        case "CERT_TYPE":
          this.CERT_TYPE = val;
          break;
        case "AGENT_GERT_TYPE":
          this.AGENT_GERT_TYPE = val;
          break;
        case "SIGN_TYPE":
          this.SIGN_TYPE = val;
          break;
        case "PRC_CODE":
          this.PRC_CODE = val;
          break;
        default:
          break;
      }
    },
    bindRadio(e) {
      console.log(e.target.value);
      if (e.target.value == 1) {
        Vue.set(this, "radioShowY", true);
        Vue.set(this, "radioShowN", false);
      } else {
        Vue.set(this, "radioShowY", false);
        Vue.set(this, "radioShowN", true);
      }
    },
    saveAction(type) {
      console.log(this.change_type);
      Vue.set(this, "submitType", type);
      if (this.change_type == 2) {
        let data = [
          {
            CHANGE_TYPE: type == 2 ? "3" : "2",
            AGENT_NAME: this.AGENT_NAME,
            EFFECT_DATE: this.EFFECT_DATE,
            AGENT_TEL: this.AGENT_TEL,
            HOUSING_AREA: this.HOUSING_AREA,
            AGENT_CERT_NUM: this.AGENT_CERT_NUM,
            AGENT_CERT_TYPE: this.AGENT_GERT_TYPE[0],
            FILE_NAME: this.FILE_NAME,
            CERT_NUM: this.CERT_NUM,
            CONT_PHONE: this.CONT_PHONE,
            ELEC_FILE_NAME: this.ELEC_FILE_NAME,
            CONT_NO: this.CONT_NO,
            SIGN_ADDR: this.SIGN_ADDR,
            END_DATE: this.END_DATE,
            CERT_TYPE: this.CERT_TYPE[0],
            SIGN_TYPE: this.SIGN_TYPE[0],
            PRC_CODE: this.PRC_CODE[0]
          }
        ];
        console.log(this.FILE.length);
        if (this.FILE.length == 2) {
          for (let i in this.FILE) {
            deletePhoto(this.FILE[i].FILE_SRC, function(msg) {
              console.log(msg);
            });
            sqlFILE_Delete(
              "CONTRACT_FILE_RELATION",
              this.FILE[i].FILE_ID,
              function(str, msg) {
                console.log(str, msg);
              }
            );
          }
          this.fileInsert(JSON.parse(this.$route.query.item).M_CID);
        } else if (this.FILE.length == 0) {
          console.log("11aaaaaaaaaaaaaaaaaaaaaa");
          console.log(this.FILE_LIST);
          for (let i in this.FILE_LIST) {
            console.log(111111, this.FILE_LIST[i].FILE_SRC);
            deletePhoto(this.FILE_LIST[i].FILE_SRC, function(msg) {
              console.log(msg);
            });
            sqlFILE_Delete(
              "CONTRACT_FILE_RELATION",
              this.FILE_LIST[i].FILE_ID,
              function(str, msg) {
                console.log(str, msg);
              }
            );
          }
        } else if (this.FILE.length != 0) {
          this.$vux.toast.text("请上传证件正反面照片");
          return;
        }
        console.log(JSON.parse(this.$route.query.item).M_CID);
        console.log(this.CONS_NO);
        if (this.M_CID) {
          //修改
          sqlUpdata(
            "CUST_COUTRACTINFO_CHANGE",
            JSON.parse(this.$route.query.item).M_CID,
            this.CONS_NO,
            data,
            this.callback
          );
        } else {
          sqlUpdataChange(
            "CUST_COUTRACTINFO_CHANGE",
            "CONT_ID",
            JSON.parse(this.$route.query.item).CONT_ID,
            this.CONS_NO,
            data,
            this.callback
          );
        }
      } else {
        const M_CID = getsn();
        Vue.set(this, "M_CID", M_CID);
        let data = [
          {
            M_CID: M_CID,
            APP_NO: "",
            CHANGE_TYPE: type == 2 ? "3" : "1",
            CONS_NO: this.CONS_NO,
            AGENT_NAME: this.AGENT_NAME,
            EFFECT_DATE: this.EFFECT_DATE,
            AGENT_TEL: this.AGENT_TEL,
            HOUSING_AREA: this.HOUSING_AREA,
            AGENT_CERT_NUM: this.AGENT_CERT_NUM,
            AGENT_CERT_TYPE: this.AGENT_GERT_TYPE[0],
            FILE_NAME: this.FILE_NAME,
            CERT_NUM: this.CERT_NUM,
            CONT_PHONE: this.CONT_PHONE,
            ELEC_FILE_NAME: this.ELEC_FILE_NAME,
            CONT_NO: this.CONT_NO,
            SIGN_ADDR: this.SIGN_ADDR,
            END_DATE: this.END_DATE,
            CERT_TYPE: this.CERT_TYPE[0],
            SIGN_TYPE: this.SIGN_TYPE[0],
            PRC_CODE: this.PRC_CODE[0]
          }
        ];
        sqlInsert("CUST_COUTRACTINFO_CHANGE", data, this.callback);
        this.fileInsert(M_CID);
      }
    },
    callback(str, msg) {
      if (this.submitType == 1) {
        if (msg.resultCode === "9999") {
          if (str == "sqlInsert") {
            this.$vux.toast.text("添加成功");
            Vue.set(this, "change_type", 2);
          } else if (str == "sqlUpdata") {
            this.$vux.toast.text("修改成功");
          }
        } else {
          this.$vux.toast.text("失败");
        }
      } else {
        this.$vux.toast.text("提交成功");
      }
    },
    addIconClick() {
      this.FILE_NAME = "";
      this.CERT_NUM = "";
      this.CONT_PHONE = "";
      this.EFFECT_DATE = "";
      this.ELEC_FILE_NAME = "";
      this.AGENT_CERT_NUM = "";
      this.CONT_NO = "";
      this.AGENT_GERT_TYPE = [];
      this.SIGN_ADDR = "";
      this.END_DATE = "";
      this.CERT_TYPE = [];
      this.SIGN_TYPE = [];
      this.PRC_CODE = [];
      this.AGENT_NAME = "";
      this.AGENT_TEL = "";
      this.HOUSING_AREA = "";
      this.FILE = [];
      Vue.set(this, "photoPathZ", "");
      Vue.set(this, "photoPathF", "");
      Vue.set(this, "change_type", 1);
    },
    submitAction: function() {
      console.log("提交");
      const data = {
        CONTR_INFO: [
          {
            SIGN_TYPE: this.SIGN_TYPE[0],
            AGENT_NAME: this.AGENT_NAME,
            AGENT_TEL: this.AGENT_TEL,
            AGENT_CERT_NUM: this.AGENT_CERT_NUM,
            AGENT_CERT_TYPE: this.AGENT_GERT_TYPE[0],
            APP_NO: this.userInfoData.APP_NO,
            ORG_NO: this.userInfoData.ORG_NO,
            CONS_ID: this.userInfoData.CONS_ID,
            CONS_NO: this.CONS_NO,
            CONS_NAME: this.userInfoData.CONS_NAME,
            CONTR_NO: this.CONT_NO,
            CONTR_TYPE: "",
            CONTR_SORT: "",
            CT_NO: "",
            SUPPLY_SIGNPER: UserInfo.USER,
            SUPPLY_SIGNPER_NAME: this.ELEC_FILE_NAME,
            SIGN_PER: "",
            SIGN_DATE: "",
            SIGN_ADDR: this.SIGN_ADDR,
            SIGN_CHANNEL: this.userInfoData.APP_NO == "" ? "01" : "02",
            EFFECT_DATE: this.EFFECT_DATE,
            VALID_PERIOD: "",
            INVALID_DATE: this.END_DATE,
            CONT_PHONE: this.CONT_PHONE,
            CERT_TYPE: this.CERT_TYPE[0],
            CERT_NUM: this.CERT_NUM,
            SIGN_REMARK: "",
            GAS_NARURE: "",
            PRC_TYPE: "",
            PRC_CODE: this.PRC_CODE[0],
            PREGAS_AMT: "",
            GM_TYPE: "",
            GM_FLOW: "",
            APP_RUN_NGQ: "",
            YEAT_RUN_NGQ: "",
            SCH_REMARK: "",
            HOUSING_AREA: this.HOUSING_AREA,
            M_CID: !this.M_CID ? getsn() : this.M_CID
          }
        ]
      };
      console.log(data);
      submitremoval(data, "RMB018", this.submitActionCallback);
    },
    submitActionCallback(result) {
      if (result.resultCode === "9999") {
        this.saveAction(2);
      }
    }
  },
  mounted() {
    // this.getNewDate()

    // 证件类型
    const _that = this;
    Vue.set(_that, "CONS_NO", localStorage.getItem("CONS_NO"));
    AndroidApi.queryTableData(
      '{"whereClause":"select * from P_CODE where code_type= ?","whereArgs":["cdReCertType"]}',
      function(msg) {
        if (msg.resultCode === "9999") {
          const CERT_TYPE_LIST = msg.result.map(item => {
            return {
              name: item.CODE_NAME,
              value: item.CODE_VALUE
            };
          });
          Vue.set(_that, "CERT_TYPE_LIST", [CERT_TYPE_LIST]);
        }
      }
    );
    // 代办人证件类型
    // const _that = this;
    AndroidApi.queryTableData(
      '{"whereClause":"select * from P_CODE where code_type= ?","whereArgs":["cdReCertType"]}',
      function(msg) {
        if (msg.resultCode === "9999") {
          const AGENT_GERT_TYPE_LIST = msg.result.map(item => {
            return {
              name: item.CODE_NAME,
              value: item.CODE_VALUE
            };
          });
          Vue.set(_that, "AGENT_GERT_TYPE_LIST", [AGENT_GERT_TYPE_LIST]);
        }
      }
    );
    // 签订类型
    AndroidApi.queryTableData(
      '{"whereClause":"select * from P_CODE where code_type= ?","whereArgs":["cmCtrSignOperType"]}',
      function(msg) {
        if (msg.resultCode === "9999") {
          const SIGN_TYPE_LIST = msg.result.map(item => {
            return {
              name: item.CODE_NAME,
              value: item.CODE_VALUE
            };
          });
          Vue.set(_that, "SIGN_TYPE_LIST", [SIGN_TYPE_LIST]);
        }
      }
    );
    // 气费价格
    AndroidApi.queryTableData(
      '{"whereClause":"select * from P_CODE where code_type= ?","whereArgs":["mrPrcType"]}',
      function(msg) {
        if (msg.resultCode === "9999") {
          const PRC_CODE_LIST = msg.result.map(item => {
            return {
              name: item.CODE_NAME,
              value: item.CODE_VALUE
            };
          });
          Vue.set(_that, "PRC_CODE_LIST", [PRC_CODE_LIST]);
        }
      }
    );
    // 赋值
    const _this = this;
    if (_this.$route.query.item) {
      const item = JSON.parse(_this.$route.query.item);
      console.log(22222, item);
      _this.M_CID = item.M_CID;
      _this.CONS_NO = item.CONS_NO;
      _this.FILE_NAME = item.FILE_NAME;
      _this.CERT_NUM = item.CERT_NUM;
      _this.AGENT_CERT_NUM = item.AGENT_CERT_NUM;
      _this.CONT_PHONE = item.CONT_PHONE;
      _this.ELEC_FILE_NAME = item.ELEC_FILE_NAME;
      _this.CONT_NO = item.CONT_NO;
      _this.SIGN_ADDR = item.SIGN_ADDR;
      _this.END_DATE = item.END_DATE;
      _this.CERT_TYPE[0] = item.CERT_TYPE;
      _this.SIGN_TYPE[0] = item.SIGN_TYPE;
      _this.PRC_CODE[0] = item.PRC_CODE;
      _this.AGENT_NAME = item.AGENT_NAME;
      _this.AGENT_GERT_TYPE[0] = item.AGENT_CERT_TYPE;
      _this.AGENT_TEL = item.AGENT_TEL;
      _this.HOUSING_AREA = item.HOUSING_AREA;
      Vue.set(_this, "change_type", _this.$route.query.change_type);
      sqlFILE_QueryAll(
        "CONTRACT_FILE_RELATION",
        "CONTRACT_CID",
        item.M_CID,
        _this.queryPhotoCallback
      );
    }
    userInfoFn(this.CONS_NO, this.userInfoCallback);
  },
  created() {
    // 赋值
    const _this = this;
    Vue.set(this, "EFFECT_DATE", dateFormat(new Date(), "YYYY-MM-DD"));
    if (_this.$route.query.item) {
      const item = JSON.parse(_this.$route.query.item);
      console.log(22222, item);
      _this.EFFECT_DATE = item.EFFECT_DATE;
    }
  }
};
</script>
<style scoped lang="less">
@import "../../assets/less/style.less";
.maintain-title {
  height: 1.1111rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding-left: 0.2778rem;
  &-icon {
    width: 0.0833rem;
    height: 0.5555rem;
    margin-right: 0.2778rem;
  }
  &-text {
    font-size: 0.4167rem;
    color: #444444;
  }
}
</style>
<style>
@import "../../assets/less/vuxStyle.less";
</style>

